﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Input;
using AnthStat.Domain;

namespace AnthStat.WPF.Applications
{
    public sealed class DesignProjectViewModel : ViewModelBase
    {
        #region Properties
        private Project Project { get; set; }
        public ICollectionView ChildrenView { get; set; }
        private ObservableCollection<PersonViewModel> PeopleCollection { get; set; }
        #endregion // Properties

        #region Constructors
        public DesignProjectViewModel()
        {
            Project = new Project("Yuritania School System", String.Empty, @"C:\Users\bioha_000\Documents\Visual Studio 2013\Projects\AnthStat\bin\Debug\Projects\SampleAnthStatFile.apj", DataCaptureMode.IndividualAssessments);

            PeopleCollection = new ObservableCollection<PersonViewModel>();

            foreach (Person person in Project.People)
            {
                PersonViewModel personVM = new PersonViewModel(person);
                personVM.InitializeCollectionViews();
                PeopleCollection.Add(personVM);
            }

            ChildrenView = new CollectionViewSource { Source = PeopleCollection }.View;
            ChildrenView.Filter = new Predicate<object>
                    (
                        p =>
                            ((PersonViewModel)p).IsMeasureable == true
                    );
        }
        #endregion // Constructors

        #region Commands
        #endregion // Commands
    }
}
